package com.ruoyi.djb.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.djb.domain.DjbPhoneCode;
import com.ruoyi.djb.mapper.DjbPhoneCodeMapper;
import com.ruoyi.djb.service.IDjbPhoneCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 验证码Service业务层处理
 * 
 * @author xxd
 * @date 2024-08-27
 */
@Service
public class DjbPhoneCodeServiceImpl implements IDjbPhoneCodeService 
{
    @Autowired
    private DjbPhoneCodeMapper djbPhoneCodeMapper;

    /**
     * 查询验证码
     * 
     * @param id 验证码主键
     * @return 验证码
     */
    @Override
    public DjbPhoneCode selectDjbPhoneCodeById(Integer id)
    {
        return djbPhoneCodeMapper.selectDjbPhoneCodeById(id);
    }

    /**
     * 查询验证码列表
     * 
     * @param djbPhoneCode 验证码
     * @return 验证码
     */
    @Override
    public List<DjbPhoneCode> selectDjbPhoneCodeList(DjbPhoneCode djbPhoneCode)
    {
        return djbPhoneCodeMapper.selectDjbPhoneCodeList(djbPhoneCode);
    }

    /**
     * 新增验证码
     * 
     * @param djbPhoneCode 验证码
     * @return 结果
     */
    @Override
    public int insertDjbPhoneCode(DjbPhoneCode djbPhoneCode)
    {
        djbPhoneCode.setCreateTime(DateUtils.getNowDate());
        return djbPhoneCodeMapper.insertDjbPhoneCode(djbPhoneCode);
    }

    /**
     * 修改验证码
     * 
     * @param djbPhoneCode 验证码
     * @return 结果
     */
    @Override
    public int updateDjbPhoneCode(DjbPhoneCode djbPhoneCode)
    {
        return djbPhoneCodeMapper.updateDjbPhoneCode(djbPhoneCode);
    }

    /**
     * 批量删除验证码
     * 
     * @param ids 需要删除的验证码主键
     * @return 结果
     */
    @Override
    public int deleteDjbPhoneCodeByIds(String ids)
    {
        return djbPhoneCodeMapper.deleteDjbPhoneCodeByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除验证码信息
     * 
     * @param id 验证码主键
     * @return 结果
     */
    @Override
    public int deleteDjbPhoneCodeById(Integer id)
    {
        return djbPhoneCodeMapper.deleteDjbPhoneCodeById(id);
    }
}
